package sctu.edu.java.year2016.team07.liaohengju.day20160523.chapter6_1;

import com.sun.org.apache.xpath.internal.SourceTree;

import java.net.SocketPermission;

/**
 * Created by hengju on 2016/5/23.
 * 在项目中创建Number类，判断字符串“mingrikejijavabu”中字符‘i’出现了几次，并将结果输出。
 */
public class Number {
    public static void main(String[] args) {
        char a[] = {'m', 'i', 'n', 'g', 'r', 'i', 'k', 'e', 'j', 'i', 'j', 'a', 'v', 'a', 'b', 'u'};
        String s = new String(a);
        System.out.println("字符串是:" + s);
        int j = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] == 'i') {
                j++;
            }
        }
        System.out.println("字符串mingrikejijavabu中字符'i'出现的次数为：" + j);
    }
}
